package com.sky.mapper;

import com.sky.entity.User;
import com.sky.vo.DateVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    /**
     * 根据openid查询用户
     * @param openid
     */
    @Select("select * from user where openid = #{openid}")
    User queryByOpenid(String openid);

    /**
     * 插入微信用户信息
     * XML配置文件
     * @param user
     */
    int insertUser(User user);
    /**
     * 根据id查询用户
     * @param id
     * @return
     */
    @Select("select * from user where id = #{id}")
    User queryById(Long id);

    /**
     * 统计用户数量
     * @param dateVO
     * @return
     */
    @Select("select count(*) from user where create_time<=#{end}")
    Integer countUser(DateVO dateVO);

    /**
     * 统计新增用户数量
     * @param dateVO
     * @return
     */
    @Select("select count(*) from user where create_time between #{begin} and #{end}")
    Integer countNewUser(DateVO dateVO);
}
